[Java] Listening for TCP and UDP requests on the same port
Posted
by user339328
on Stack Overflow
See other posts from Stack Overflow
or by user339328
Published on 2010-05-12T13:37:25Z
Indexed on
2010/05/12
14:14 UTC
Read the original article
Hit count: 141
I am writing a Client/Server set of programs
Depending on the operation requested by the client, I use make TCP or UDP request.
Implementing the client side is straight-forward, since I can easily open connection with any protocol and send the request to the server-side.
On the servers-side, on the other hand, I would like to listen both for UDP and TCP connections on the same port. Moreover, I like the the server to open new thread for each connection request.
I have adopted the approach explained in: link text
I have extended this code sample by creating new threads for each TCP/UDP request.
This works correctly if I use TCP only, but it fails when I attempt to make UDP bindings.
Please give me any suggestion how can I correct this.
tnx
© Stack Overflow or respective owner